/*
 * @Description: 应用
 * @Author: bxsdhx
 * @Date: 2023-08-29 11:01:05
 * @LastEditTime: 2024-02-21 21:03:42
 * Copyright (C) 2023 bxsdhx. All rights reserved.
 */
import type { Bullet, Aircraft } from "@/type";
import { defineStore } from "pinia";
export default defineStore("app", {
  /**
   * 数据
   */
  state() {
    return {
      /**
       * 状态
       *
       * begin 待开始
       *
       * progress 进行中
       *
       * over 结束
       */
      status: <"begin" | "progress" | "over">"begin",
      /**
       * 游戏是否暂停
       */
      isPause: false,
      /**
       * 分数
       */
      fraction: 0,
      /**
       * 玩家
       */
      player: <Aircraft>{
        id: "player",
        type: "player",
        x: 0,
        y: 0,
        blood: 1,
        status: true,
      },
      /**
       * 子弹
       */
      bulletList: <Bullet[]>[],
      /**
       * 杀敌数
       */
      kills: 0,
      /**
       * 敌机
       */
      enemyList: <Aircraft[]>[],
    };
  },
  /**
   * 数据计算
   */
  getters: {},
  /**
   * 内部函数
   */
  actions: {},
  /**
   * 持久化配置
   */
  persist: {
    paths: [],
  },
});
